STRUCTS = {1: 'B', 2: 's', 3: 'H', 4: 'I', 5: 'II', 6: 'b',
           7: 'x', 8: 'h', 9: 'i', 10: 'ii', 11: 'f', 12: 'd', 16: 'Q', 17: 'q', 18: 'Q'}

#tag: {name_lower():(name,tag,type,description if description else None)}
#description :{name:value}
TAGS_ = {'artist': ('Artist', 315, 2),
         'axisdistance_x': ('AxisDistance_X', 45576, 10),
         'axisdistance_y': ('AxisDistance_Y', 45577, 10),
         'axisdistance_z': ('AxisDistance_Z', 45578, 10),
         'baselinelength': ('BaselineLength', 45574, 5),
         'baseviewpointnum': ('BaseViewpointNum', 45572, 4),
         'bestqualityscale': ('BestQualityScale', 50780, 5),
         'bitspersample': ('BitsPerSample', 258, 3),
         'celllength': ('CellLength', 265, 3),
         'cellwidth': ('CellWidth', 264, 3),
         'colormap': ('ColorMap', 320, 3),
         'compression': ('Compression',
                         259,
                         3,
                         {1: 'Uncompressed',
                          2: 'CCITT 1d',
                          3: 'Group 3 Fax',
                          4: 'Group 4 Fax',
                          5: 'LZW',
                          6: 'JPEG',
                          32773: 'PackBits'}),
         'convergenceangle': ('ConvergenceAngle', 45573, 10),
         'copyright': ('Copyright', 33432, 2),
         'datetime': ('DateTime', 306, 2),
         'documentname': ('DocumentName', 269, 2),
         'dotrange': ('DotRange', 336, 3),
         'exififd': ('ExifIFD', 34665, 3),
         'extrasamples': ('ExtraSamples', 338, 3),
         'fillorder': ('FillOrder', 266, 3),
         'freebytecounts': ('FreeByteCounts', 289, 4),
         'freeoffsets': ('FreeOffsets', 288, 4),
         'gpsinfoifd': ('GPSInfoIFD', 34853, 1),
         'grayresponsecurve': ('GrayResponseCurve', 291, 3),
         'grayresponseunit': ('GrayResponseUnit', 290, 3),
         'halftonehints': ('HalftoneHints', 321, 3),
         'hostcomputer': ('HostComputer', 316, 2),
         'iccprofile': ('ICCProfile', 34675, 7),
         'imagedescription': ('ImageDescription', 270, 2),
         'imagejmetadata': ('ImageJMetaData', 50839, 7),
         'imagejmetadatabytecounts': ('ImageJMetaDataByteCounts', 50838, 4),
         'imagelength': ('ImageLength', 257, 4),
         'imageuidlist': ('ImageUIDList', 45059, 7),
         'imagewidth': ('ImageWidth', 256, 4),
         'inknames': ('InkNames', 333, 2),
         'inkset': ('InkSet', 332, 3),
         'jpegactables': ('JPEGACTables', 521, 4),
         'jpegdctables': ('JPEGDCTables', 520, 4),
         'jpeginterchangeformat': ('JPEGInterchangeFormat', 513, 4),
         'jpeginterchangeformatlength': ('JPEGInterchangeFormatLength', 514, 4),
         'jpeglosslesspredictors': ('JPEGLosslessPredictors', 517, 3),
         'jpegpointtransforms': ('JPEGPointTransforms', 518, 3),
         'jpegproc': ('JPEGProc', 512, 3),
         'jpegqtables': ('JPEGQTables', 519, 4),
         'jpegrestartinterval': ('JPEGRestartInterval', 515, 3),
         'make': ('Make', 271, 2),
         'makernotesafety': ('MakerNoteSafety', 50741, 3, {0: 'Unsafe', 1: 'Safe'}),
         'maxsamplevalue': ('MaxSampleValue', 281, 3),
         'minsamplevalue': ('MinSampleValue', 280, 4),
         'model': ('Model', 272, 2),
         'mpentry': ('MPEntry', 45058, 7),
         'mpfversion': ('MPFVersion', 45056, 7),
         'mpindividualnum': ('MPIndividualNum', 45313, 4),
         'newsubfiletype': ('NewSubfileType', 254, 4),
         'numberofimages': ('NumberOfImages', 45057, 4),
         'numberofinks': ('NumberOfInks', 334, 3),
         'orientation': ('Orientation', 274, 3),
         'pagename': ('PageName', 285, 2),
         'pagenumber': ('PageNumber', 297, 3),
         'panorientation': ('PanOrientation', 45569, 4),
         'panoverlap_h': ('PanOverlap_H', 45570, 5),
         'panoverlap_v': ('PanOverlap_V', 45571, 5),
         'photometricinterpretation': ('PhotometricInterpretation',
                                       262,
                                       3,
                                       {0: 'WhiteIsZero',
                                        1: 'BlackIsZero',
                                        2: 'RGB',
                                        3: 'RGB Palette',
                                        4: 'Transparency Mask',
                                        5: 'CMYK',
                                        6: 'YCbCr',
                                        8: 'CieLAB',
                                        32803: 'CFA',
                                        32892: 'LinearRaw'}),
         'pitchangle': ('PitchAngle', 45580, 10),
         'planarconfiguration': ('PlanarConfiguration',
                                 284,
                                 3,
                                 {1: 'Contiguous', 2: 'Separate'}),
         'predictor': ('Predictor', 317, 3, {1: 'none', 2: 'Horizontal Differencing'}),
         'primarychromaticities': ('PrimaryChromaticities', 319, 3),
         'referenceblackwhite': ('ReferenceBlackWhite', 532, 4),
         'resolutionunit': ('ResolutionUnit', 296, 3, {1: 'none', 2: 'inch', 3: 'cm'}),
         'rollangle': ('RollAngle', 45581, 10),
         'rowsperstrip': ('RowsPerStrip', 278, 4),
         'sampleformat': ('SampleFormat', 339, 3),
         'samplesperpixel': ('SamplesPerPixel', 277, 3),
         'smaxsamplevalue': ('SMaxSampleValue', 341, 12),
         'sminsamplevalue': ('SMinSampleValue', 340, 12),
         'software': ('Software', 305, 2),
         'stripbytecounts': ('StripByteCounts', 279, 4),
         'stripoffsets': ('StripOffsets', 273, 4),
         'subfiletype': ('SubfileType', 255, 3),
         't4options': ('T4Options', 292, 4),
         't6options': ('T6Options', 293, 4),
         'targetprinter': ('TargetPrinter', 337, 2),
         'threshholding': ('Threshholding', 263, 3),
         'tilebytecounts': ('TileByteCounts', 325, 4),
         'tilelength': ('TileLength', 323, 4),
         'tileoffsets': ('TileOffsets', 324, 4),
         'tilewidth': ('TileWidth', 322, 4),
         'totalframes': ('TotalFrames', 45060, 4),
         'transferfunction': ('TransferFunction', 301, 3),
         'transferrange': ('TransferRange', 342, 3),
         'verticaldivergence': ('VerticalDivergence', 45575, 10),
         'whitepoint': ('WhitePoint', 318, 5),
         'xposition': ('XPosition', 286, 5),
         'xresolution': ('XResolution', 282, 5),
         'yawangle': ('YawAngle', 45579, 10),
         'ycbcrcoefficients': ('YCbCrCoefficients', 529, 5),
         'ycbcrpositioning': ('YCbCrPositioning', 531, 3),
         'ycbcrsubsampling': ('YCbCrSubSampling', 530, 3),
         'yposition': ('YPosition', 287, 5),
         'yresolution': ('YResolution', 283, 5)}

#tag:{name:(tag,type,des if des else None)}
# des:{name:value}
TAGS = {}
for k, v in TAGS_.items():
    TAGS[v[1]] = (v[0], *v[1:])
